home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / which < prev    next >
Text File  |  1995-05-16  |  650b  |  42 lines

  1. #!/bin/csh -f
  2.  
  3. set prompt = "% "
  4. if ( -f ~/.cshrc) then
  5.     source ~/.cshrc
  6. endif
  7. set noglob
  8. foreach arg ( $argv )
  9.     set alius = `alias $arg`
  10.     switch ( $#alius )
  11.     case 0 :
  12.         breaksw
  13.     case 1 :
  14.         set arg = $alius[1]
  15.         breaksw
  16.         default :
  17.         echo ${arg}: "    " aliased to $alius
  18.         continue
  19.     endsw
  20.     unset found
  21.     if ( $arg:h != $arg:t ) then
  22.     if ( -e $arg ) then
  23.         echo $arg
  24.     else
  25.         echo "$arg not found"
  26.     endif
  27.     continue
  28.     else
  29.     foreach i ( $path )
  30.         if ( -x $i/$arg && ! -d $i/$arg ) then
  31.         echo $i/$arg
  32.         set found
  33.         break
  34.         endif
  35.     end
  36.     endif
  37.     if ( ! $?found ) then
  38.     echo "no $arg in $path"
  39.     endif
  40. end
  41.  
  42.